package com.zixuan.sina.controller;

import com.zixuan.sina.entity.vo.PostQuery;
import com.zixuan.sina.entity.vo.PostVo;
import com.zixuan.sina.service.PostService;
import com.zixuan.sina.utils.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/api/video/")
public class VideoController {
    @Resource
    private PostService postService;

    @GetMapping("list")
    public Result listVideo(@RequestParam String key, String type, String userId, String startTime,String endTime) { //后期数据放入es中 ik分词器进行减速
        return postService.listVideo(key,type,userId,startTime,endTime);
    }



    @GetMapping("getVideoDataById")
    public Result getVideoDataById(@RequestParam String postId){
        PostQuery postQuery = new PostQuery();
        postQuery.setPostId(postId);
        Result<List<PostVo>> listResult = postService.queryPost(postQuery);
        return listResult;
    }

}
